package edu.rit.drh4818.raytracing.tone;

import java.awt.Color;

/**
 * @author Darren Headrick
 *
 */
public class GreyMap extends ToneReproduction
{

	public GreyMap() 
	{
		super(0);
	}

	public Color[][] transform( Color[][] original )
	{
		Color[][] rv = new Color[ original.length ][ original[0].length ];
		
		for( int x = 0; x < original.length; x++ )
		{
			for( int y = 0; y < original[x].length; y++ )
			{
				int sum = original[x][y].getBlue() + original[x][y].getRed() + original[x][y].getGreen();
				sum /= 3;
				rv[x][y] = new Color( sum,sum, sum );
			}
		}
	
		return rv;
	}
}
